Developer Documentation

QuickTime 4 API Documentation

Inside Macintosh: QuickTime

Previous | Overview | Contents | Next |

Working With Pictures

The Image Compression Manager provides a set of functions that allow applications to work easily with compressed pictures stored in version 2 PICT files. These functions constitute a high-level interface to image compression and decompression. Applications that require little control over the compression process may use these functions to display pictures that contain compressed image data.

Existing programs can display (without changes) pictures that contain compressed image data. When the Image Compression Manager is installed on a system, it installs a new StdPix graphics function (see Working With the StdPix Function for more information on the StdPix graphics function). This function handles all requests to display compressed images. Whenever an application issues the standard QuickDraw DrawPicture routine (described in Inside Macintosh: Imaging ) to display an image that contains compressed image data, the StdPix function decompresses the image by invoking the Image Compression Manager. The function then delivers the decompressed image to the application.

The Image Compression Manager also provides a simple mechanism for creating a picture that contains compressed image data. For example, to place an existing compressed image into a picture, your application could open the picture with QuickDraw's OpenPicture (or OpenCPicture ) function and then call the Image Compression Manager's DecompressImage function, as if you were going to display the image. The Image Compression Manager places the compressed image and the other data that describe the image into the picture for you.

The Image Compression Manager stores the following information about a compressed picture:

The Image Compression Manager stores this information in the picture as a new PICT opcode (described in the following paragraphs). When an application draws the compressed picture on a Macintosh computer that is running the Image Compression Manager, the StdPix function instructs the Image Compression Manager to decompress the image. If an application tries to read a picture file that contains compressed data on a Macintosh that does not have the Image Compression Manager installed, the system ignores the new opcodes and displays a message that indicates that the user needs QuickTime in order to display the compressed image data. The message states "QuickTime and a <Codec Name> decompressor are needed to see this picture".

The Color QuickDraw version 2 picture format includes PICT opcodes for compressed and uncompressed QuickTime images. (An opcode is a hexidecimal number that represents drawing commands and the parameters that affect those drawing commands in a picture.) For more information on the version 2 picture format, see the chapter "Color QuickDraw" in Inside Macintosh: Imaging .

The PICT opcodes for compressed and uncompressed QuickTime images are

Table 1 gives an overview of the opcode for QuickTime compressed pictures.

Table 1 Fields of the PICT opcode for compressed QuickTime images

Field name

Description

Data size (in bytes)

Opcode

Compressed picture data

2

Size

Size in bytes of data for this opcode

4

Version

Version of this opcode

2

Matrix

3 by 3 fixed transformation matrix

36

MatteSize

Size of matte data in bytes

4

MatteRect

Rectangle for matte data

8

Mode

Transfer mode

2

SrcRect

Rectangle for source

8

Accuracy

Preferred accuracy

4

MaskSize

Size of mask region in bytes

4

Warning
Do not attempt to read opcodes directly. For compatibility reasons, use Toolbox routines to access this information.

The MaskSize field of opcode $8200 is followed by five variable fields:

See "The Image Description Structure," for details on the idSize and dataSize fields.

Table 2 provides an overview of the structure of uncompressed QuickTime images.

Table 2 Fields of the PICT opcode for uncompressed QuickTime images

Field name

Description

Data size (in bytes)

Opcode

Uncompressed picture data

2

Size

Size in bytes of data for this opcode

4

Version

Version of this opcode

2

Matrix

3 by 3 fixed transformation matrix

36

MatteSize

Size of matte data in bytes

4

MatteRect

Rectangle for matte data

8

The MatteRect field of opcode $8201 is followed by three variable fields and a subopcode:


© 1999 Apple Computer, Inc.

Previous | Overview | Contents | Next